

<!-- jQuery 2.2.3 -->
<script src="<?= site_url('style/plugins/jQuery/jquery-2.2.3.min.js'); ?>"></script>
<!-- Bootstrap 3.3.6 -->
<script src="<?= site_url('style/bootstrap/js/bootstrap.min.js'); ?>"></script>
<!-- DataTables -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/i18n/defaults-*.min.js"></script>
<script src="<?= site_url('style/plugins/datatables/jquery.dataTables.min.js'); ?>"></script>
<script src="<?= site_url('style/plugins/datatables/dataTables.bootstrap.min.js'); ?>"></script>
<!-- SlimScroll -->
<script src="<?= site_url('style/plugins/slimScroll/jquery.slimscroll.min.js'); ?>"></script>
<!-- FastClick -->
<script src="<?= site_url('style/plugins/fastclick/fastclick.js'); ?>"></script>
<!-- AdminLTE App -->
<script src="<?= site_url('style/dist/js/app.min.js'); ?>"></script>
<script src="<?= site_url('style/dist/js/demo.j'); ?>s"></script>

<script type="text/javascript">
  var pageMenu = {"active": [1,12]};
</script>
<script src="<?= site_url('style/js/vendors.js'); ?>" type="text/javascript"></script>
<script src="<?= site_url('style/js/index.js'); ?>" type="text/javascript"></script>
<!-- page script -->

<script type="text/javascript">
  //添加颜色设置
  	
    $(function(){
      $(".add-sytem").click(function(event) {
        $("#sytem-ct").append('<tr><td><input type="text" name="good_name[]" class="form-control"></td><td><div class="col-xs-7 div-center"><input type="file" name="good_img[]"></div></td><td><input type="text" name="colour_name[]" class="form-control"></td><td><div class="col-xs-7 div-center"><input type="file" name="colour_img[]"></div></td><td class="dispy-fix"><button type="button" class="btn btn-default btn-xs btn-flat margin text-blue sytem-dlter">删除</button></td></tr>');
      });
      //删除
      jQuery(document).ready().on("click",".sytem-dlter",function(){
      	
        var ff = $(this).parents("tr").remove();
        console.log(ff);
      });

    })
</script>
<!-- page script -->
<script type="text/javascript">
       $(function () {
          CKEDITOR.replace('editor1');
        });
 
      //图片上传预览    IE是用了滤镜。
        $("#preview").click(function(event) {
          $("#pto").hide().click();
        });
        function previewImage(file)
        {
          var MAXWIDTH  = 260; 
          var MAXHEIGHT = 180;
          var div = document.getElementById('preview');
          if (file.files && file.files[0])
          {
              div.innerHTML ='<img id=imghead>';
              var img = document.getElementById('imghead');
              img.onload = function(){
                var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
                img.width  =  rect.width;
                img.height =  rect.height;
//                 img.style.marginLeft = rect.left+'px';
                img.style.marginTop = rect.top+'px';
              }
              var reader = new FileReader();
              reader.onload = function(evt){img.src = evt.target.result;}
              reader.readAsDataURL(file.files[0]);
          }
          else //兼容IE
          {
            var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
            file.select();
            var src = document.selection.createRange().text;
            div.innerHTML = '<img id=imghead>';
            var img = document.getElementById('imghead');
            img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
            var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
            status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
            div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";
          }
        }
        function clacImgZoomParam( maxWidth, maxHeight, width, height ){
            var param = {top:0, left:0, width:width, height:height};
            if( width>maxWidth || height>maxHeight )
            {
                rateWidth = width / maxWidth;
                rateHeight = height / maxHeight;
                 
                if( rateWidth > rateHeight )
                {
                    param.width =  maxWidth;
                    param.height = Math.round(height / rateWidth);
                }else
                {
                    param.width = Math.round(width / rateHeight);
                    param.height = maxHeight;
                }
            }
            param.left = Math.round((maxWidth - param.width) / 2);
            param.top = Math.round((maxHeight - param.height) / 2);
            return param;
        }
</script>  
</body>
</html>